<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="cn.school.mybatis.utils.MyBatisUtil" %>
<%@ page import="cn.school.mybatis.pojo.Student" %>
<%@ page import="cn.school.mybatis.dao.StudentDao" %>
<%@ page import="cn.school.mybatis.service.StudentService" %><%--
  Created by IntelliJ IDEA.
  User: zhaoyang
  Date: 2020/8/4
  Time: 9:44 上午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改学生信息</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");

    int id = new Integer(request.getParameter("stuid"));
    String sname = request.getParameter("stuName");
    String sex = request.getParameter("stuSex");
    String telephone = request.getParameter("stuPhone");
    String qq = request.getParameter("stuQQ");
    String wechat = request.getParameter("stuWechat");
    int gradeid = new Integer(request.getParameter("stuGrade"));
    String enterdate = request.getParameter("enterTime");
    String fromcity = request.getParameter("fromCity");
    String birthday = request.getParameter("stuBirth");
    String address = request.getParameter("stuAddr");


    Student student = new Student(id,sname, sex, telephone, qq, wechat, gradeid, enterdate, fromcity, birthday, address);
//    Student student2 = new Student(227, "李狗蛋-522", "男", null, "233333227", null, 3, "2020-07-04", "巢湖", "2020-07-05", "合肥包河");

    int result = StudentService.STUDENT_SERVICE.update(student);
//    out.print(student);
//    out.print(student2);


%>

<script>
    if (confirm(<%=result%>+"信息修改成功！")) {
        location.replace("s_studentInfo.jsp");
    } else {
        location.replace("../index.jsp");
    }
    <%--    if (<%=result%>==1) {--%>
    <%--        alter("信息增加成功！")--%>
    <%--        location.replace("s_studentAdd.jsp");--%>
    <%--    } else {--%>
    <%--        alter("信息增加失败...")--%>
    <%--        history.back(-1);--%>
    <%--    }--%>
</script>

</body>
</html>
